#!/bin/sh
#
# Start application ...
#
echo "Start application ...\n"
case "$1" in
	start)
		NSTAR_UPDATE=""
		APP=""
		if [ -x /bin/nstar_update ]; then
			NSTAR_UPDATE=/bin/nstar_update
		fi	
		if [ "$NSTAR_UPDATE" != "" ]; then
			echo "start run NSTAR_UPDATE\n"	
			$NSTAR_UPDATE
			echo "now start run app\n"
		else
			echo "no update, run app\n"
		fi	

		ifconfig eth0 192.168.251.180
		mount -t nfs 192.168.251.176:/home/qlqcetc/nfs/ /mnt -o nolock,wsize=16384,rsize=16384,udp 

		if [ -x /app/out.elf ]; then
			APP=/app/out.elf
		fi

		if [ "$APP" != "" ]; then
			echo "app ok\n"
			$APP &
		else
			echo "no app\n"
			#$NSTAR_UPDATE no_app
			#echo "if run here, app don't update, reboot soon\n"
			#reboot
		fi
	;;
	stop|restart|reload)
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac

